<template>
  <div class="listCard">
    <div class="title">{{listData.title}}</div>
    <img v-if="listData.gallery !== ''" class="gallery" :src="listData.gallery" />
    <div v-if="listData.items4.length > 0" class="items4">
      <div class="item" v-for="item in listData.items4" :key="item.id">
        <div class="img-area">
          <div class="tips" v-if="item.desc" :style="{backgroundColor: item.desc.bgColor}">{{item.desc.tip}}</div>
          <img :src="item.imgUrl" />
          <div class="promotion">{{item.promotion}}</div>
        </div>
        <div class="name">{{item.name}}</div>
        <div class="price">
          ¥{{item.price}}
          <del v-if="item.oldPrice !== ''">¥{{item.oldPrice}}</del>
        </div>
      </div>
    </div>
    <div class="goods">
      <div class="item" v-for="item in listData.goods" :key="item.id">
        <div class="img-area">
          <div class="tips" v-if="item.desc" :style="{backgroundColor: item.desc.bgColor}">{{item.desc.tip}}</div>
          <img :src="item.imgUrl" />
          <div class="promotion">{{item.promotion}}</div>
        </div>
        <div class="name">{{item.name}}</div>
        <div class="price">
          ¥{{item.price}}
          <del v-if="item.oldPrice !== ''">¥{{item.oldPrice}}</del>
        </div>
      </div>
    </div>
    <div v-if="listData.moreText !== ''" class="footer">
      <span class="more">{{listData.moreText}}</span>
      <span class="icon"></span>
    </div>
    <div class="specLine"></div>
  </div>
</template>

<script>
export default {
  name: 'listCard',
  props: {
    listData: Object // 
  },
  data () {
    return {
    }
  }
}
</script>

<style scoped lang="scss">
.listCard{
  .title{
    color: #444;
    height: 36px;
    padding: 40px 0;
    font-size: 40px;
  }
  .gallery{
    width: 730px;
    height: 210px;
    margin: 10px;
    border-radius: 14px;
  }
  .items4{
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    flex-wrap: wrap;
    margin-bottom: 30px;
    .item{
      width: 360px;
      margin-bottom: 20px;
      .img-area{
        background: #f9f9f9;
        width: 360px;
        height: 360px;
        border-radius: 14px;
        display: flex;
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
        overflow: hidden;
        position: relative;
        .tips{
          position: absolute;
          top: 0;
          left: 50%;
          white-space: nowrap;
          transform: translateX(-50%);
          color: white;
          font-size: 20px;
          padding: 0 20px ;
          border-radius: 0 0 8px 8px;
        }
        img{
          width: 254px;
          height: 254px;
          align-self: center;
          margin-top: 40px;
        }
        .promotion{
          font-size: 24px;
          color: #9b9b9b;
          background: rgba(155,155,155,.1);
          padding: 0 20px;
          width: 320px;
          height: 40px;
          line-height: 40px;
          overflow: hidden;
          text-overflow: ellipsis;
          display: -webkit-box;
          -webkit-line-clamp: 1;
          -webkit-box-orient: vertical;
          white-space: normal;
          align-self: flex-end;
        }
      }
      .name{
        font-style: normal;
        font-weight: 400;
        color: #333;
        font-size: 28px;
        margin: 18px 0 6px 0;
      }
      .price{
        font-size: 24px;
        color: #ca141d;
        del{
          color: #999;
        }
      }
    }
  }
  .goods{
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow: scroll;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
    &::-webkit-scrollbar{
      display: none;
    }
    margin-left: 5px;
    .item{
      width: 350px;
      margin: 0 5px;
      .img-area{
        background: #f9f9f9;
        width: 260px;
        height: 266px;
        border-radius: 14px;
        display: flex;
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
        overflow: hidden;
        position: relative;
        .tips{
          position: absolute;
          top: 0;
          left: 50%;
          white-space: nowrap;
          transform: translateX(-50%);
          color: white;
          font-size: 20px;
          padding: 0 20px ;
          border-radius: 0 0 8px 8px;
        }
        img{
          width: 176px;
          height: 176px;
          align-self: center;
          margin-top: 20px;
        }
        .promotion{
          font-size: 24px;
          color: #9b9b9b;
          background: rgba(155,155,155,.1);
          padding: 0 20px;
          width: 220px;
          height: 40px;
          line-height: 40px;
          overflow: hidden;
          text-overflow: ellipsis;
          display: -webkit-box;
          -webkit-line-clamp: 1;
          -webkit-box-orient: vertical;
          white-space: normal;
          align-self: flex-end;
        }
      }
      .name{
        font-style: normal;
        font-weight: 400;
        color: #333;
        font-size: 28px;
        margin: 18px 0 6px 0;
      }
      .price{
        font-size: 24px;
        color: #ca141d;
        del{
          color: #999;
        }
      }
    }
  }
  .footer{
    height: 90px;
    line-height: 90px;
    text-align: center;
    display: flex;
    flex-direction: row;
    justify-content: center;
    flex-wrap: nowrap;
    align-content: center;
    span{
      display: flex;
    }
    .more{
      color: #333333;
      font-size: 28px;
    }
    .icon{
      width: 22px;
      background-image: url(../../../../static/images/arrow_right.png);
      background-position: center center;
      background-repeat: no-repeat;
      background-size: 16px 24px;
    }
  }
  .specLine{
    height: 30px;
    background-color: #f9f9f9;
  }
}
</style>
